package com.forclass;

import java.lang.reflect.Constructor;

public class ConstructorsTest {
    public static void main(String[] args) throws Exception {
        Class<?> clazz= Class.forName("com.forclass.Books");
//        System.out.println("****getConstructors()******");
//        for(Constructor<?> tmp: clazz.getConstructors()) {
//            System.out.println("构造函数11==" + tmp);
//        }
//
//        System.out.println("****getDeclaredConstructors()******");
//        for(Constructor<?> tmp: clazz.getDeclaredConstructors()) {
//            System.out.println("构造函数22==" + tmp);
//        }
        Constructor<?> con = clazz.getDeclaredConstructor(String.class,String.class,double.class);
        Object obj = con.newInstance("java进阶开发","lixinghua",90);
        System.out.println(obj);
    }
}
